<?php

namespace Rebuild\Config;

use Rebuild\Contract\ConfigInterface;

class Config implements ConfigInterface
{
    protected $config = [];

    public function __construct($config)
    {
        $this->config = $config;
    }

    public function get(string $key, $default = null)
    {
        return $this->config[$key] ?? $default;
    }

    public function has(string $key)
    {
        return isset($this->config[$key]);
    }

    public function set(string $key, $value)
    {
        $this->config[$key] = $value;
    }
}